package org.shoukaiseki.supersaiyan.common.inittable;



import org.shoukaiseki.inittable.domain.TableColumnInfo;
import org.shoukaiseki.inittable.domain.TableIndexInfo;
import org.shoukaiseki.inittable.service.ITableBuildInfoService;
import org.shoukaiseki.kakaroto.SksDictUtils;
import org.shoukaiseki.kakaroto.annotation.TableBuild;
import org.shoukaiseki.supersaiyan.enums.Sks0Enable1Deactivate;
import org.shoukaiseki.supersaiyan.enums.SysUserUserType;

import java.util.List;

import static org.shoukaiseki.inittable.utils.SksColumnCamelCaseCommon.*;
import static org.shoukaiseki.inittable.utils.TableColumnInfoBuilder.column;
import static org.shoukaiseki.inittable.utils.TableInfoUtils.tableColumns;
import static org.shoukaiseki.inittable.utils.TableInfoUtils.tableIndexs;


//@TableBuild(name = "sys_user", comment = "用户信息表",version = 1)
public class SysUserInitTableInfo implements ITableBuildInfoService {

    public static final String TABLE_NAME = "sys_user";

    @Override
    public List<TableColumnInfo> tableColumnInfoList(){
        List<TableColumnInfo> table = tableColumns(

                uniqueId("user_id","用户ID"),
                varColumn("user_name","用户账号",30,true),
                varColumn("nick_name","用户昵称",30,true),
                //实际未使用
                column(" user_type varchar(2) default '00' not null comment '用户类型',")
                        .description(SksDictUtils.getDictInfo(SysUserUserType.class))
                        .remark("（00系统用户）"),
                column(" email varchar(50) default '' null comment '用户邮箱',"),
                column(" phonenumber varchar(11) default '' null comment '手机号码',"),
                column(" sex char(1) default '0' null comment '用户性别（0男 1女 2未知）',"),
                column(" avatar varchar(256) default '' null comment '头像地址',"),
                column(" password varchar(100) default '' null comment '密码',"),



                column(" login_ip varchar(50) default '' null comment '最后登录IP',"),
                column(" login_date datetime null comment '最后登录时间',"),
                column(" remark varchar(500) null comment '备注'"),

                status()
                        .description(SksDictUtils.getDictInfo(Sks0Enable1Deactivate.class)),
                intColumnUnsigned("all_org_flag","拥有所有组织权限"),
                intColumnUnsigned("all_site_flag","拥有所有地点权限"),
                relationshipId("def_site_id","默认地点",null,true),
                relationshipId("def_org_id","默认组织",null,true),
                siteId(),
                orgId(),
                deptId(),
                createUserId(),
                createTime(),
                updateUserId(),
                updateTime(),
                delFlag(),
                rowstamp(),
                null
        );

        return table;
    }

}
